

***************************************
*********FACTORIAL EXPERIMENT**********
***************************************

clear all
*cd "" set working directory
use "immigration_speeders.dta"



*RANDOMIZATION TEST

*EMPTY MODEL
mlogit SPLIT_QF9_T4 

*MODEL WITH COVS
fvset base 7 pid
mlogit SPLIT_QF9_T4 i.H1_T4 age i.H5_T4 i.ideo i.pid attimm



*MODELS WITH SPEEDERS NO WEIGHTS SPILL-OVER EFFECT
quietly logit approved_asy i.exp_1##i.Rotation_Block_F_IMM_T4 i.exp_2##i.Rotation_Block_F_IMM_T4 i.exp_3##i.Rotation_Block_F_IMM_T4

margins, dydx(exp_1) at(Rotation_Block_F_IMM_T4=(1(1)3)) post
margins, coeflegend

test _b[1.exp_1:1bn._at]=_b[1.exp_1:2._at]
test _b[1.exp_1:2._at]=_b[1.exp_1:3._at]

margins, dydx(exp_2) at(Rotation_Block_F_IMM_T4=(1(1)3)) post
margins, coeflegend

test _b[1.exp_2:1bn._at]=_b[1.exp_2:2._at]
test _b[1.exp_2:2._at]=_b[1.exp_2:3._at]

margins, dydx(exp_3) at(Rotation_Block_F_IMM_T4=(1(1)3)) post
margins, coeflegend

*TESTS
test _b[1.exp_1:1bn._at]=_b[1.exp_1:3._at]
test _b[1.exp_2:1bn._at]=_b[1.exp_2:3._at]
test _b[1.exp_3:1bn._at]=_b[1.exp_3:3._at]


*MODELS WITH SPEEDERS NO WEIGHTS SPILL-OVER EFFECT CONDITIONING ON ORDER
quietly logit approved_asy i.exp_1##i.exp_2##i.exp_3 Rotation_Block_F_IMM_T4

*MAIN EFFECTS
margins i.exp_1 i.exp_2 i.exp_3, post
margins, coeflegend



*MODELS WITH SPEEDERS WEIGHTS APPLIED
quietly logit approved_asy i.exp_1##i.exp_2##i.exp_3 [pw = int_wt1_cap_T4]

*MAIN EFFECTS
margins i.exp_1 i.exp_2 i.exp_3, post
margins, coeflegend



*MODELS WITHOUT SPEEDERS NO WEIGHTS

clear all
*cd "" set working directory
use "immigration_speeders.dta"

quietly logit approved_asy i.exp_1##i.exp_2##i.exp_3

*MAIN EFFECTS
margins i.exp_1 i.exp_2 i.exp_3, post
margins, coeflegend
